//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.web.controller.member;

import com.aidong.dao.base.ConditionMap;
import com.aidong.dao.base.Pagination;
import com.aidong.dao.wills.BoxRentDao;
import com.aidong.dao.wills.CardTimeLimitDao;
import com.aidong.dao.wills.CardTypeCodeDao;
import com.aidong.dao.wills.CustomerComplaintDao;
import com.aidong.dao.wills.DicShopAreaCodeDao;
import com.aidong.dao.wills.MemberBlackListDao;
import com.aidong.dao.wills.MemberContractDao;
import com.aidong.dao.wills.MemberInfoDao;
import com.aidong.dao.wills.MemberStopedCardDao;
import com.aidong.dao.wills.MemberUseDao;
import com.aidong.dao.wills.PtBespeakDao;
import com.aidong.model.RequestInfo;
import com.aidong.model.wills.CardTypeCode;
import com.aidong.model.wills.MemberContract;
import com.aidong.model.wills.MemberInfo;
import com.aidong.model.wills.MemberStopedCard;
import com.aidong.model.wills.MemberUse;
import com.aidong.model.wills.PtBespeak;
import com.aidong.util.ExportXlsx;
import com.aidong.web.controller.BaseController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping({"memberUse"})
public class MemberUseController extends BaseController {
    @Resource
    MemberUseDao memberUseDao;
    @Resource
    MemberInfoDao memberInfoDao;
    @Resource
    MemberContractDao memberContractDao;
    @Resource
    MemberStopedCardDao memberStopedCardDao;
    @Resource
    CardTypeCodeDao cardTypeCodeDao;
    @Resource
    DicShopAreaCodeDao dicShopAreaCodeDao;
    @Resource
    CardTimeLimitDao cardTimeLimitDao;
    @Resource
    PtBespeakDao ptBespeakDao;
    @Resource
    BoxRentDao boxRentDao;
    @Resource
    CustomerComplaintDao customerComplaintDao;
    @Resource
    protected MemberBlackListDao memberBlackListDao;

    public MemberUseController() {
    }

    @RequestMapping({"list"})
    public ModelAndView list() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return (new ModelAndView("member/use/list")).addObject("shopName", this.getTypeList("shopName")).addObject("dt1", sdf.format(new Date(System.currentTimeMillis() - 86400000L))).addObject("dt2", sdf.format(new Date()));
    }

    @RequestMapping({"_list"})
    public ModelAndView _list(@RequestParam(value = "shopCode",required = false) String shopCode, @RequestParam(value = "cardCode",required = false) String cardCode, @RequestParam(value = "contractCode",required = false) String contractCode, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "dateFrom",required = false) String dateFrom, @RequestParam(value = "dateTo",required = false) String dateTo, @RequestParam(value = "pageNo",required = false) String pageNo, @RequestParam(value = "totalCount",required = false) String totalCount) {
        Pagination pg = new Pagination(1, 20);
        pg.setPage(this.parseInt(pageNo), this.parseInt(totalCount));
        ConditionMap cd = new ConditionMap();
        this.addConditionShopCode(cd, "shopCode", shopCode);
        cd.eq("cardCode", cardCode);
        cd.eq("contractCode", contractCode);
        if(!this.chkNull(dateFrom)) {
            cd.ge("inTime", this.getDateFrom(dateFrom));
        }

        if(!this.chkNull(dateTo)) {
            cd.le("inTime", this.getDateTo(dateTo));
        }

        String year = null;
        if(!this.chkNull(dateFrom)) {
            year = dateFrom.substring(0, 4);
        }

        ConditionMap cd2 = new ConditionMap();
        cd2.eq("i.chName", name);
        this.memberUseDao.queryPageList(pg, cd, cd2, year);
        ModelAndView mv = new ModelAndView("member/use/_list");
        mv.addObject("list", pg.getResultList());
        mv.addObject("pg", pg);
        return mv;
    }

    @RequestMapping({"expt"})
    public ModelAndView expt(@RequestParam(value = "shopCode",required = false) String shopCode, @RequestParam(value = "cardCode",required = false) String cardCode, @RequestParam(value = "contractCode",required = false) String contractCode, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "dateFrom",required = false) String dateFrom, @RequestParam(value = "dateTo",required = false) String dateTo, HttpServletResponse response) {
        try {
            Pagination e = new Pagination(1, 990000);
            e.setPage(Integer.valueOf(1), Integer.valueOf(1));
            ConditionMap cd = new ConditionMap();
            this.addConditionShopCode(cd, "shopCode", shopCode);
            cd.eq("cardCode", cardCode);
            cd.eq("contractCode", contractCode);
            if(!this.chkNull(dateFrom)) {
                cd.ge("inTime", this.getDateFrom(dateFrom));
            }

            if(!this.chkNull(dateTo)) {
                cd.le("inTime", this.getDateTo(dateTo));
            }

            String year = null;
            if(!this.chkNull(dateFrom)) {
                year = dateFrom.substring(0, 4);
            }

            ConditionMap cd2 = new ConditionMap();
            cd2.eq("i.chName", name);
            this.memberUseDao.queryPageList(e, cd, cd2, year);
            ExportXlsx xls = new ExportXlsx(response, "会员出入场流水", "会员出入场流水");
            xls.addHead(new String[]{"门店编号", "门店名称", "会员编号", "会员姓名", "会员卡号", "合同号", "卡种", "入场时间", "出场时间", "消耗次数", "操作员"});
            xls.setWidth(new int[]{10, 15, 20, 10, 10, 15, 20, 20, 20, 10, 15});
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Iterator i$ = e.getResultList().iterator();

            while(i$.hasNext()) {
                MemberUse use = (MemberUse)i$.next();
                xls.addRow(new Object[]{use.getShopCode(), this.cache.getValue("shopName", use.getShopCode()), use.getMemberCode(), use.getMemberName(), use.getCardCode(), use.getContractCode(), this.cache.getValue("cardType", String.valueOf(use.getCardType())), use.getInTime() == null?null:sdf.format(use.getInTime()), use.getOutTime() == null?null:sdf.format(use.getOutTime()), this.chkNullZ(use.getUseCount())?"-":use.getUseCount(), this.nvl(use.getCreateUser()) + " - " + this.nvl(this.cache.getValue("userName", use.getCreateUser()))});
            }

            xls.close();
            this.addUserLog("导出会员出入场流水", e.getResultList().size() + "条记录");
        } catch (Exception var16) {
            this.log.error("import", var16);
        }

        return null;
    }

    @RequestMapping({"getInList"})
    public ModelAndView getInList() {
        List list = this.memberUseDao.getTodayInList(this.getLoginShopCode());
        ModelAndView mv = new ModelAndView("member/use/_inlist");
        mv.addObject("list", list);
        return mv;
    }

    @RequestMapping({"getInfo"})
    public ModelAndView getInfo(@RequestParam("memberCode") String memberCode) {
        MemberInfo member = this.memberInfoDao.getById(memberCode);
        if(member == null) {
            member = new MemberInfo();
        }

        MemberContract contract = this.memberContractDao.getByMemberCode(memberCode);
        if(contract == null) {
            contract = this.memberContractDao.getCurrentByMemberCode(memberCode);
        }

        StringBuilder sb = new StringBuilder();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        Date dt = this.boxRentDao.getEndDateByMemberCode(this.getLoginShopCode(), memberCode);
        if(dt != null && sdf.format(dt).compareTo(sdf.format(new Date())) <= 0) {
            sdf = new SimpleDateFormat("M月d号");
            sb.append(sdf.format(dt) + "租箱到期");
        }

        sdf = new SimpleDateFormat("MM-dd");
        if(member.getBirthday() != null && sdf.format(member.getBirthday()).equals(sdf.format(new Date()))) {
            sb.append(" 会员今天生日");
        }

        if(this.customerComplaintDao.chkHasNewByMemberCode(memberCode)) {
            sb.append(" 90天内有过客诉");
        }

        if(this.memberBlackListDao.chkExists(member.getIdType(), member.getIdNumber())) {
            sb.append(" 会员证件号在黑名单中");
        }

        ModelAndView mv = new ModelAndView("member/use/info");
        mv.addObject("member", member);
        mv.addObject("contract", contract);
        mv.addObject("note", sb.toString());
        mv.addObject("_picPath", this.getSetting("pic.path"));
        return mv;
    }

    @RequestMapping({"chkEnter"})
    @ResponseBody
    public String chkEnter(@RequestParam("code") String code) {
        if(!this.chkNull(code) && !this.chkNull(code.trim())) {
            MemberInfo member = this.memberInfoDao.findMember(code.trim());
            if(member == null) {
                member = this.memberInfoDao.getByCardCode(code);
            }

            if(member == null) {
                return this.getResult(false, "没有这个会员");
            } else {
                int status = 0;
                String msg = null;
                boolean isstop = false;
                boolean isopen = false;
                MemberContract contract = null;
                String shopCode = this.getLoginShopCode();
                Object list = this.memberContractDao.getEnterListByMemberCode(member.getMemberCode(), new Date());
                if(list == null) {
                    list = new ArrayList();
                }

                String msg1 = null;
                if(((List)list).size() == 0) {
                    MemberContract quotaCard = this.memberContractDao.getStopedByMemberCode(member.getMemberCode());
                    if(quotaCard != null) {
                        ((List)list).add(quotaCard);
                        isstop = true;
                    }

                    if(quotaCard == null) {
                        quotaCard = this.memberContractDao.getNotOpenByMemberCode(member.getMemberCode());
                        if(quotaCard != null) {
                            ((List)list).add(quotaCard);
                            isopen = true;
                        }
                    }
                }

                if(((List)list).size() > 0) {
                    for(Iterator quotaCard1 = ((List)list).iterator(); quotaCard1.hasNext(); msg1 = "不能在本店使用!") {
                        MemberContract sb = (MemberContract)quotaCard1.next();
                        if(this.memberContractDao.chkContractShop(sb.getContractCode(), shopCode)) {
                            contract = sb;
                        } else if(!this.chkNull(sb.getManyShop())) {
                            CardTypeCode ww = (CardTypeCode)this.cardTypeCodeDao.getById(sb.getCardType());
                            if(ww != null && ww.getManyShopQuantity().intValue() == 0 && this.dicShopAreaCodeDao.chkAreaShop(sb.getManyShop(), shopCode)) {
                                contract = sb;
                            }
                        } else if(shopCode.equalsIgnoreCase(sb.getShopCode())) {
                            contract = sb;
                        }

                        if(contract != null) {
                            break;
                        }
                    }
                } else {
                    msg1 = "会员无有效合同";
                }

                if(contract == null) {
                    msg = msg1;
                }

                if(msg == null) {
                    MemberUse quotaCard2 = null;
                    if(!isstop) {
                        quotaCard2 = this.memberUseDao.getTodayInByMemberCode(shopCode, member.getMemberCode());
                    }

                    if(quotaCard2 != null) {
                        if(System.currentTimeMillis() - quotaCard2.getInTime().getTime() < 10000L) {
                            msg = "已入场。请勿重复刷卡。";
                        } else {
                            status = 2;
                        }
                    } else if(contract.getTotalCount().intValue() > 0 && contract.getRestCount().intValue() == 0) {
                        msg = "次数卡入场次数已用尽";
                    } else {
                        Calendar sb1 = Calendar.getInstance();
                        int ww1 = sb1.get(7);
                        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
                        String tim = sdf.format(sb1.getTime());
                        if(this.cardTimeLimitDao.chkTimeLimit(contract.getCardType(), String.valueOf(ww1), tim)) {
                            msg = "不能在本时段入场";
                        }
                    }
                }

                if(isstop && msg != null) {
                    msg = "无有效合同";
                }

                if(msg == null && status == 0) {
                    status = isopen?4:(isstop?3:1);
                }

                String quotaCard3 = null;
                if(contract != null) {
                    CardTypeCode sb2 = (CardTypeCode)this.cardTypeCodeDao.getById(contract.getCardType());
                    if(sb2 != null) {
                        quotaCard3 = sb2.getQuotaCardPic();
                    }
                }

                StringBuilder sb3 = new StringBuilder();
                sb3.append("{memberCode:\"").append(member.getMemberCode()).append("\"").append(",cardCode:\"").append(member.getCardCode()).append("\"").append(",memberName:\"").append(this.convStr(member.getChName())).append("\"").append(",status:").append(status).append("").append(",msg:\"").append(this.convStr(msg)).append("\"").append(this.chkNull(quotaCard3)?"":",quotaCard:\"" + this.getSetting("pic.path") + quotaCard3 + "\"").append("}");
                return this.getSuccess(sb3.toString(), "");
            }
        } else {
            return this.getResult(false, "请输入会员卡");
        }
    }

    @RequestMapping({"add"})
    public ModelAndView add() {
        ModelAndView mv = new ModelAndView("member/use/add");
        mv.addObject("_oper", "add");
        return mv;
    }

    @RequestMapping({"_add"})
    @ResponseBody
    public String _add(@RequestParam("memberCode") String memberCode, @RequestParam(value = "tp",required = false) String tp) {
        MemberInfo member = this.memberInfoDao.getById(memberCode);
        if(member == null) {
            return this.getResult(false, "没有这个会员");
        } else if("3".equals(tp) && !this.stopedOpen(member)) {
            return this.getResult(false, "不能开卡!");
        } else if("4".equals(tp) && !this.earlyOpen(member)) {
            return this.getResult(false, "不能开卡!");
        } else {
            MemberContract contract = null;
            String shopCode = this.getLoginShopCode();
            List list = this.memberContractDao.getEnterListByMemberCode(member.getMemberCode(), new Date());
            if(list != null && list.size() != 0) {
                Iterator cal1 = list.iterator();

                while(cal1.hasNext()) {
                    MemberContract dt1 = (MemberContract)cal1.next();
                    if(this.memberContractDao.chkContractShop(dt1.getContractCode(), shopCode)) {
                        contract = dt1;
                    } else if(!this.chkNull(dt1.getManyShop())) {
                        CardTypeCode ptbList = (CardTypeCode)this.cardTypeCodeDao.getById(dt1.getCardType());
                        if(ptbList != null && ptbList.getManyShopQuantity().intValue() == 0 && this.dicShopAreaCodeDao.chkAreaShop(dt1.getManyShop(), shopCode)) {
                            contract = dt1;
                        }
                    } else if(shopCode.equalsIgnoreCase(dt1.getShopCode())) {
                        contract = dt1;
                    }

                    if(contract != null) {
                        break;
                    }
                }

                if(contract == null) {
                    return this.getResult(false, "不能在本店入场");
                } else {
                    Calendar cal11 = Calendar.getInstance();
                    cal11.add(11, -2);
                    cal11.set(11, 2);
                    Date dt11 = cal11.getTime();
                    cal11.add(5, 1);
                    List ptbList1 = this.ptBespeakDao.getPrintListByMemberCode(this.getLoginShopCode(), member.getMemberCode(), dt11, cal11.getTime());
                    StringBuilder sb = new StringBuilder();
                    sb.append("{ptb:[");

                    PtBespeak timeLimit;
                    for(Iterator cardType = ptbList1.iterator(); cardType.hasNext(); sb.append(timeLimit.getAutoId())) {
                        timeLimit = (PtBespeak)cardType.next();
                        if(sb.length() > 6) {
                            sb.append(",");
                        }
                    }

                    sb.append("]}");
                    CardTypeCode cardType1 = (CardTypeCode)this.cardTypeCodeDao.getById(contract.getCardType());
                    boolean timeLimit1 = false;
                    if(cardType1 != null && (cardType1.getTimeLock().intValue() == 1 || cardType1.getNoBusyCard().intValue() == 1)) {
                        Calendar msg = Calendar.getInstance();
                        int use1 = msg.get(7);
                        SimpleDateFormat use = new SimpleDateFormat("HH:mm");
                        String req = use.format(msg.getTime());
                        timeLimit1 = this.cardTimeLimitDao.chkTimeLimit(contract.getCardType(), String.valueOf(use1), req);
                    }

                    String msg1 = "";
                    MemberUse use11 = this.memberUseDao.getTodayInByMemberCode(shopCode, member.getMemberCode());
                    if(use11 != null) {
                        if(!"2".equals(tp)) {
                            return this.getResult(false, "不能重复入场");
                        }

                        if(System.currentTimeMillis() - use11.getInTime().getTime() < 10000L) {
                            return this.getResult(false, "已入场。请勿重复刷卡。");
                        }

                        use11.setOutTime(new Date());
                        use11.setUpdateTime(new Date());

                        try {
                            if(cardType1 != null && cardType1.getNoBusyCard().intValue() == 1 && timeLimit1 && !this.chkNullZ(cardType1.getDeductQuantity()) && contract.getRestCount().intValue() > 0) {
                                int use1 = Math.min(cardType1.getDeductQuantity().intValue(), contract.getRestCount().intValue());
                                use11.setUseCount(Integer.valueOf(1 + use1));
                                this.memberUseDao.updateOut(use11);
                                msg1 = "超过出场时间，一次性扣除次卡里的次数" + use1 + "次";
                            } else {
                                this.memberUseDao.update(use11);
                            }

                            this.addUserLog("会员出场", "编号:" + member.getMemberCode() + ",名称:" + member.getChName());
                        } catch (Exception var20) {
                            this.log.error("out memberuse", var20);
                            return this.getResult(false, "保存发生错误");
                        }
                    } else {
                        if(contract.getTotalCount().intValue() > 0 && contract.getRestCount().intValue() == 0) {
                            return this.getResult(false, "次数卡入场次数已用尽");
                        }

                        if(timeLimit1) {
                            return this.getResult(false, "不能在本时段入场");
                        }

                        MemberUse use2 = new MemberUse();
                        use2.setShopCode(shopCode);
                        use2.setMemberCode(member.getMemberCode());
                        use2.setCardCode(member.getCardCode());
                        use2.setContractCode(contract.getContractCode());
                        use2.setCheckType("1");
                        use2.setCheckIp(this.getIpAddr());
                        RequestInfo req1 = this.userSession.getRequestInfo();
                        if(req1 != null) {
                            use2.setCheckTerminal(req1.getOsType());
                        }

                        use2.setInTime(new Date());
                        if(contract.getRestCount().intValue() > 0) {
                            use2.setUseCount(Integer.valueOf(1));
                            use2.setUseBeforCount(contract.getRestCount());
                        } else {
                            use2.setUseCount(Integer.valueOf(0));
                            use2.setUseBeforCount(Integer.valueOf(0));
                        }

                        use2.setUseDate(new Date());
                        use2.setCreateUser(this.getLoginUserCode());
                        use2.setCreateTime(new Date());
                        use2.setUpdateTime(new Date());

                        try {
                            this.memberUseDao.addUse(use2);
                            this.addUserLog("会员入场", "编号:" + member.getMemberCode() + ",名称:" + member.getChName());
                            if(ptbList1 != null && ptbList1.size() > 0) {
                                Iterator e = ptbList1.iterator();

                                while(e.hasNext()) {
                                    PtBespeak b = (PtBespeak)e.next();
                                    this.ptBespeakDao.addBespeakSign(b);
                                }
                            }
                        } catch (Exception var19) {
                            this.log.error("add memberuse", var19);
                            return this.getResult(false, "保存发生错误");
                        }
                    }

                    return this.getSuccess(sb.toString(), msg1);
                }
            } else {
                return this.getResult(false, "会员无有效合同");
            }
        }
    }

    private boolean earlyOpen(MemberInfo member) {
        MemberContract contract = this.memberContractDao.getNotOpenByMemberCode(member.getMemberCode());
        if(contract == null) {
            return false;
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date dt1 = this.parseDate(sdf.format(contract.getBeginTime()), sdf);
            Date dt2 = this.parseDate(sdf.format(new Date()), sdf);
            int dd = (int)((dt1.getTime() - dt2.getTime()) / 1000L / 60L / 60L / 24L);
            if(dd <= 0) {
                return false;
            } else {
                contract.setBeginTime(dt2);
                Calendar cal = Calendar.getInstance();
                cal.setTime(contract.getEndTime());
                cal.add(5, -dd);
                contract.setEndTime(cal.getTime());
                if(contract.getNewEndTime() != null) {
                    cal.setTime(contract.getNewEndTime());
                    cal.add(5, -dd);
                    contract.setNewEndTime(cal.getTime());
                }

                contract.setNote((contract.getNote() == null?"":contract.getNote() + " ") + "提前开卡" + sdf.format(dt1) + "->" + sdf.format(dt2));
                this.memberContractDao.updateContractTime(contract);
                return true;
            }
        }
    }

    private boolean stopedOpen(MemberInfo member) {
        MemberStopedCard stopedCard = this.memberStopedCardDao.getStopedByMemberCode(member.getMemberCode());
        if(stopedCard == null) {
            return false;
        } else {
            MemberContract oldContract = this.memberContractDao.getByContractCode(stopedCard.getContractCode());
            if(oldContract == null) {
                return false;
            } else {
                stopedCard.setOpenDate(new Date());
                stopedCard.setOpenUser(this.getLoginUserCode());
                Date dt1 = this.getTrimDate(stopedCard.getBeginStopTime());
                Date dt2 = this.getTrimDate(new Date(stopedCard.getEndStopTime().getTime() + 86400000L));
                if(dt2.after(new Date())) {
                    dt2 = this.getTrimDate(new Date());
                }

                int dd = (int)((dt2.getTime() - dt1.getTime()) / 1000L / 60L / 60L / 24L);
                if(dd <= 0) {
                    return false;
                } else {
                    Calendar cal = Calendar.getInstance();
                    cal.setTime(oldContract.getEndTime());
                    cal.add(5, dd);
                    Date endTime = cal.getTime();
                    Date newEndTime = null;
                    if(oldContract.getNewEndTime() != null) {
                        cal.setTime(oldContract.getNewEndTime());
                        cal.add(5, dd);
                        newEndTime = cal.getTime();
                    }

                    MemberContract contract = new MemberContract();
                    contract.setShopCode(this.getLoginShopCode());
                    contract.setMemberCode(member.getMemberCode());
                    contract.setCardCode(member.getCardCode());
                    contract.setSaleType("6");
                    contract.setPromotionId((Integer)null);
                    contract.setEarnestId((Integer)null);
                    contract.setEarnestAmount(Double.valueOf(0.0D));
                    contract.setSaleDate(new Date());
                    contract.setBeginTime(dt2);
                    contract.setEndTime(endTime);
                    contract.setNewEndTime(newEndTime);
                    contract.setTotalCount(oldContract.getRestCount());
                    contract.setRestCount(oldContract.getRestCount());
                    contract.setCardType(oldContract.getCardType());
                    contract.setManyShop(oldContract.getManyShop());
                    contract.setValids(oldContract.getValids());
                    contract.setValidUnit(oldContract.getValidUnit());
                    contract.setAddValids(oldContract.getAddValids());
                    contract.setAddValidUnit(oldContract.getAddValidUnit());
                    contract.setAddFee(oldContract.getAddFee());
                    contract.setFixedFee(oldContract.getFixedFee());
                    contract.setStopFee(oldContract.getStopFee());
                    contract.setChangeFee(oldContract.getChangeFee());
                    contract.setMendFee(oldContract.getMendFee());
                    contract.setChgShopFee(oldContract.getChgShopFee());
                    contract.setContDiscount(oldContract.getContDiscount());
                    contract.setCardPrice(stopedCard.getOutAmount());
                    contract.setTotalPrice(stopedCard.getOutAmount());
                    contract.setFactPrice(stopedCard.getOutAmount());
                    contract.setPayAmount(Double.valueOf(0.0D));
                    contract.setInAmount(stopedCard.getOutAmount());
                    contract.setStatus(Integer.valueOf(1));
                    contract.setOldContractCode(stopedCard.getContractCode());
                    contract.setCommissionDate(new Date());
                    contract.setReceivePaper(Integer.valueOf(0));
                    contract.setBarcodeTasteContract(Integer.valueOf(0));
                    contract.setSignStatus(Integer.valueOf(2));
                    contract.setPrintLabel(Integer.valueOf(0));
                    contract.setSalesCode(oldContract.getSalesCode());
                    contract.setSalesCode2(oldContract.getSalesCode2());
                    contract.setCreateUser(this.getLoginUserCode());
                    contract.setCreateTime(new Date());
                    contract.setUpdateTime(new Date());
                    contract.setReviewStatus(Integer.valueOf(0));
                    this.memberStopedCardDao.addOpenCard(stopedCard, contract);
                    return true;
                }
            }
        }
    }
}
